package com.shop.web;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
 * 登录Controller
 * @author JILEI
 *
 */
@Controller
@RequestMapping("/admin")
public class AdminController {
	 
	@RequestMapping("/toLogin.do")
	public String adminToLogin(){
		return "login";
	}
	
	@RequestMapping(value = "/login.do",method=RequestMethod.POST)
    public String login(String username, String password, Model model) throws Exception {
    	//管理员账号登录后台管理主页
    	if("admin".equals(username) && "123456".equals(password)) {
    		return "index";
    	}
    	//普通用户重定向到前台首页
    	//FIXME 到时候改为前台主页的具体路由即可
    	return "redirect:/index2";
    }
	 
}
